import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import axios from 'axios'
import '@/plugins/element.js'
// 引入element-ui样式 引入全局css 引入iconfont
import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/css/global.css'
import '@/assets/font/iconfont.css'
// 表格第三方插件
import TreeTable from 'vue-table-with-tree-grid'
// 导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
// 项目进度条
import NProgress from 'nprogress'
// 全局过滤器
import '@/filter' // for bubble theme
Vue.use(VueQuillEditor)
Vue.component('tree-table', TreeTable)
// http://127.0.0.1:8888/api/private/v1/原接口
axios.defaults.baseURL = 'http://www.ysqorz.top:8888/api/private/v1/'
// 添加请求拦截器显示进度条 请求拦截器消失进度条
axios.interceptors.request.use((config) => {
  // 在发送请求之前做些什么
  NProgress.start()
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
}, function (error) {
  // 对请求错误做些什么
  return Promise.reject(error)
})
// 响应拦截器消失进度条
axios.interceptors.response.use((config) => {
  NProgress.done()
  return config
})

Vue.prototype.$axios = axios
Vue.config.productionTip = false
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
